package easy;

public class a83_删除排序链表中的重复元素 {

    private static class ListNode {
        private int val;
        private ListNode next;

        private ListNode() {
        }

        private ListNode(int val) {
            this.val = val;
        }

        private ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public ListNode deleteDuplicates(ListNode head) {
        ListNode temp = head;
        while (head != null && head.next != null) {
            while (head.next != null && head.val == head.next.val) {
                head.next = head.next.next;
            }
            head = head.next;
        }
        return temp;
    }
}
